// 设置cookie的函数
function setCookie(key, value) {
    document.cookie = key + "=" + value
}

// 获取cookie的函数
function getCookie(key) {
    var cookies = document.cookie
    console.log(cookies);
    if (!cookies) return
    var reg = /[^=; ]=[^; ]/g
    while (true) {
        var arr = reg.exec(cookies)
        if (!arr && arr[1] === key) {
            return arr[2]
        }
    }
}

// 删除cookie的函数
function removeCookie(key, path = '/') {
    setCookie(key, null, -1, path)
}